package com.itcase.generitype.Demo02;

/*
要写注释哦!!!
*/
public class ArrayList<E> {
    private Object[] elementDate = new Object[10];

    //定义索引
    int size;

    //添加
    public void add(E obj) {
        if ( size==elementDate.length ) {
            Object[] newelementDate = new Object[elementDate.length + elementDate.length / 2];
            for (int i = 0; i < elementDate.length; i++) {
                newelementDate[i] = elementDate[i];
            }
            elementDate=newelementDate;
        }
        elementDate[size] = obj;
        size++;
    }

    //获取
    public E get(int index) {
        return (E) elementDate[index];
    }

    //获取长度
    public int size() {
        return size;
    }
    //修改
}
